import QtQuick 2.6
import Qt.labs.controls 1.0
import QtQuick.Layouts 1.1
import "../lib"

Navigator {
    id: nav
    title: "支付购买"
    submitted: true

    contentHeight: Math.max(iHEIGHT * 5, height)

    onSubmit: contentArea.push("../qml/EvidenceNavigator.qml")

    ColumnLayout {
        anchors.fill: parent
        anchors.margins: iWIDTH

        View {
            Layout.fillWidth: true
            Layout.preferredHeight: iHEIGHT * 2
            ColumnLayout {
                anchors.fill: parent
                anchors.margins: iWIDTH
                spacing: iHEIGHT * 0.5
                Label {
                    text: "请支付：<font color=\"darkred\">￥" +  "100.0</font>"
                }

                RowLayout {
                    Layout.fillWidth: true
                    Label {
                        text: qsTr("使用积分")
                    }

                    SpinBox {
                        value: 50
                        Layout.fillWidth: true
                    }
                    Label {
                        text: "剩余：100"
                    }
                }
            }
        }

        ListView {
            id: view
            Layout.fillHeight: true
            Layout.fillWidth: true

            ButtonGroup {id: group}
            header: Item {
                width: view.width
                height: iHEIGHT
                Label {
                    text: "商家支持的转账方式"
                    anchors.centerIn: parent
                }

                Rectangle {
                    color: "gainsboro"
                    width: parent.width * 0.6
                    anchors.horizontalCenter: parent.horizontalCenter
                    height: 1
                    anchors.bottom: parent.bottom
                }
            }
            model: ListModel {
                ListElement {
                    account: "京东小钱包：15638682936"
                    name: "收款人姓名：范俊武"
                }
                ListElement {
                    account: "京东小钱包：15638682936"
                    name: "收款人姓名：范俊武"
                }
            }

            delegate:  Rectangle {
                width: view.width
                height: iHEIGHT * 2

                RowLayout {
                    anchors.fill: parent
                    anchors.margins: iWIDTH
                    RadioButton {
                        Layout.preferredHeight: parent.height * 0.3
                        Layout.preferredWidth: parent.height * 0.3
                        ButtonGroup.group: group
                    }

                    ColumnLayout {
                        Layout.fillHeight: true
                        Layout.fillWidth: true
                        spacing: iHEIGHT * 0.3
                        Label {
                            text: model.account
                        }
                        Label {
                            text: model.name
                        }
                    }
                }
                Rectangle {
                    color: "gainsboro"
                    width: parent.width
                    height: 1
                    anchors.bottom: parent.bottom

                    visible: index != view.count - 1
                }
            }
        }
    }
}
